<?php
/* Class IssuerOrganization
 * Documentation can be found at:
* https://github.com/mozilla/openbadges/wiki/Assertions#issuerorganization */

class IssuerOrganization {
	
	/* Mandatory fields */
	private $name;
	private $url;
	
	/* Optional fields */
	private $description;
	private $image;
	private $email;
	private $revocationList;
	
	/* Getters & Setters */
	public function getName() {
		return $this->name;
	}
	
	public function setName($name) {
		$this->name = $name;
	}
	
	public function getURL() {
		return $this->url;
	}

	public function setURL($url) {
		$this->url = $url;
	}
	
	public function getDescription() {
		return $this->description;
	}
	
	public function setDescription($description) {
		$this->description = $description;
	}
	
	public function getImage() {
		return $this->image;
	}
	
	public function setImage($image) {
		$this->image = $image;
	}
	public function getEmail() {
		return $this->email;
	}
	
	public function setEmail($email) {
		$this->email = $email;
	}
	public function getRevocationList() {
		return $this->revocationList;
	}
	
	public function setRevocationList($revocationList) {
		$this->revocationList = $revocationList;
	}
	
	public function checkValidity() {
		return isset($this->name) && isset($this->url);
	}
	
	public function getArray() {
	
		if (!$this->checkValidity())
			return null;
	
		$array["name"] = $this->name;
		$array["url"] = $this->url;
		
		if (isset($this->description))
			$array["description"] = $this->description;
		
		if (isset($this->image))
			$array["image"] = $this->image;
		
		if (isset($this->email))
			$array["email"] = $this->email;
		
		if (isset($this->revocationList))
			$array["revocationList"] = $this->revocationList;
		
		return $array;
	}
}
?>